home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / JFC.bin / MultiScrollPaneUI.java < prev    next >
Text File  |  1998-06-30  |  6KB  |  182 lines

  1. /*
  2.  * @(#)MultiScrollPaneUI.java    1.12 98/02/02
  3.  * 
  4.  * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  */
  20.  
  21. package com.sun.java.swing.plaf.multi;
  22.  
  23. import java.util.Vector;
  24. import java.io.Serializable;
  25. import com.sun.java.swing.*;
  26. import java.awt.*;
  27. import com.sun.java.swing.plaf.*;
  28.  
  29. /**
  30.  * MultiScrollPaneUI implementation
  31.  * <p>
  32.  * Warning: serialized objects of this class will not be compatible with
  33.  * future swing releases.  The current serialization support is appropriate
  34.  * for short term storage or RMI between Swing1.0 applications.  It will
  35.  * not be possible to load serialized Swing1.0 objects with future releases
  36.  * of Swing.  The JDK1.2 release of Swing will be the compatibility
  37.  * baseline for the serialized form of Swing objects.
  38.  *
  39.  * @version 1.12 02/02/98
  40.  * @author Willie Walker
  41.  */
  42. public class MultiScrollPaneUI extends ScrollPaneUI 
  43.     implements Serializable {
  44.  
  45.     /**
  46.      * The Vector containing the real UI's.  This is populated 
  47.      * in the call to createUI, and can be obtained by calling
  48.      * getUIs.  The first element is guaranteed to the real UI 
  49.      * obtained from the default look and feel.
  50.      */
  51.     protected Vector uis = new Vector();
  52.  
  53. ////////////////////
  54. // Common UI methods
  55. ////////////////////
  56.  
  57.     public static ComponentUI createUI(JComponent c) {
  58.         ComponentUI mui = new MultiScrollPaneUI();
  59.         return MultiLookAndFeel.createUIs(mui,
  60.                                           ((MultiScrollPaneUI) mui).uis,
  61.                                           c);
  62.     }
  63.  
  64.     /**
  65.      * Return the list of UI's associated with this multiplexing UI.  This 
  66.      * allows processing of the UI's by an application aware of multiplexing 
  67.      * UI's on components.
  68.      */
  69.     public ComponentUI[] getUIs() {
  70.         return MultiLookAndFeel.uisToArray(uis);
  71.     }
  72.  
  73. //////////////////////
  74. // ComponentUI methods
  75. //////////////////////
  76.  
  77.     public void installUI(JComponent c) {
  78.         for (int i = 0; i < uis.size(); i++) {
  79.             ((ComponentUI) (uis.elementAt(i))).installUI(c);
  80.         }
  81.     }
  82.  
  83.     public void uninstallUI(JComponent c) {
  84.         for (int i = 0; i < uis.size(); i++) {
  85.             ((ComponentUI) (uis.elementAt(i))).uninstallUI(c);
  86.         }
  87.     }
  88.   
  89.     public void paint(Graphics g, JComponent c) {
  90.         for (int i = 0; i < uis.size(); i++) {
  91.             ((ComponentUI) (uis.elementAt(i))).paint(g,c);
  92.         }
  93.     }
  94.       
  95.     public void update(Graphics g, JComponent c) {
  96.         for (int i = 0; i < uis.size(); i++) {
  97.             ((ComponentUI) (uis.elementAt(i))).update(g,c);
  98.         }
  99.     }
  100.  
  101.     public Dimension getPreferredSize(JComponent c) {
  102.         return ((ComponentUI) (uis.elementAt(0))).getPreferredSize(c);
  103.     }
  104.  
  105.     public Dimension getMinimumSize(JComponent c) {
  106.         return ((ComponentUI) (uis.elementAt(0))).getMinimumSize(c);
  107.     }
  108.  
  109.     public Dimension getMaximumSize(JComponent c) {
  110.         return ((ComponentUI) (uis.elementAt(0))).getMaximumSize(c);
  111.     }
  112.  
  113.     public boolean contains(JComponent c, int x, int y) {
  114.         return ((ComponentUI) (uis.elementAt(0))).contains(c,x,y);
  115.     }
  116.  
  117. ///////////////////////
  118. // ScrollPaneUI methods
  119. ///////////////////////
  120.  
  121.     public int getVerticalScrollBarPolicy() {
  122.         return ((ScrollPaneUI) (uis.elementAt(0))).getVerticalScrollBarPolicy();
  123.     }
  124.     public void setVerticalScrollBarPolicy(int p) {
  125.         for (int i = 0; i < uis.size(); i++) {
  126.             ((ScrollPaneUI) (uis.elementAt(i))).setVerticalScrollBarPolicy(p);
  127.         }
  128.     }
  129.  
  130.     public int getHorizontalScrollBarPolicy() {
  131.         return ((ScrollPaneUI) (uis.elementAt(0))).getHorizontalScrollBarPolicy();
  132.     }
  133.     public void setHorizontalScrollBarPolicy(int p) {
  134.         for (int i = 0; i < uis.size(); i++) {
  135.             ((ScrollPaneUI) (uis.elementAt(i))).setHorizontalScrollBarPolicy(p);
  136.         }
  137.     }
  138.  
  139.     public JScrollBar getHorizontalScrollBar() {
  140.         return ((ScrollPaneUI) (uis.elementAt(0))).getHorizontalScrollBar();
  141.     }
  142.     public JScrollBar getVerticalScrollBar() {
  143.         return ((ScrollPaneUI) (uis.elementAt(0))).getVerticalScrollBar();
  144.     }
  145.  
  146.     public JViewport getViewport() {
  147.         return ((ScrollPaneUI) (uis.elementAt(0))).getViewport();
  148.     }
  149.     public void setViewport(JViewport v) {
  150.         for (int i = 0; i < uis.size(); i++) {
  151.             ((ScrollPaneUI) (uis.elementAt(i))).setViewport(v);
  152.         }
  153.     }
  154.  
  155.     public JViewport getRowHeader() {
  156.         return ((ScrollPaneUI) (uis.elementAt(0))).getRowHeader();
  157.     }
  158.     public void setRowHeader(JViewport v) {
  159.         for (int i = 0; i < uis.size(); i++) {
  160.             ((ScrollPaneUI) (uis.elementAt(i))).setRowHeader(v);
  161.         }
  162.     }
  163.  
  164.     public JViewport getColumnHeader() {
  165.         return ((ScrollPaneUI) (uis.elementAt(0))).getColumnHeader();
  166.     }
  167.     public void setColumnHeader(JViewport v) {
  168.         for (int i = 0; i < uis.size(); i++) {
  169.             ((ScrollPaneUI) (uis.elementAt(i))).setColumnHeader(v);
  170.         }
  171.     }
  172.  
  173.     public Component getCorner(String s) {
  174.         return ((ScrollPaneUI) (uis.elementAt(0))).getCorner(s);
  175.     }
  176.     public void setCorner(String s, Component c) {
  177.         for (int i = 0; i < uis.size(); i++) {
  178.             ((ScrollPaneUI) (uis.elementAt(i))).setCorner(s,c);
  179.         }
  180.     }
  181. }
  182.